import imapi from '../../../../utils/imapi.js'
var app = getApp()

Component({
  properties: {
    type: {
      type: Number,
      value: 0
    },
    liveList: {
      type: Array,
      value: [],
      observer: function (newVal, oldVal) {
        if (!oldVal[0]) return;
        for (var i = 0; i < oldVal.length; i++) {
          if (newVal[i].item_id == oldVal[i].item_id) {
            newVal[i] = oldVal[i]
          }
        }
      }
    },
    showTitle: {
      type: Boolean,
      value: true
    },
    showIndex: {
      type: Number,
      value: 0,
      observer: 'listChange'
    },
    zIndex: {
      type: Boolean,
      value: true
    },
    scale: {
      type: Number,
      value: 1,
    },
  },
  data: {
   // liveList: [],
  },
  ready() {
    console.log(this.data.liveList)

  },
  methods: {
   ducat(e){
   	  console.log(e);
   	  var p=e.currentTarget.dataset.id.p;
   	  var id=e.currentTarget.dataset.id.item_id;
   	  var index = e.currentTarget.dataset.index;
   	  app.globalData.cur_product = this.data.liveList[index];
   	  wx.navigateTo({
   	      url: '/pages/module/productDetail/productDetail?id=' + id + '&p=' + p,
   	  })
   },
  },
})